package com.jic.market.controller.manage;

import com.jic.common.base.vo.RestResult;
import com.jic.market.api.manage.PromotionExchangeApi;
import com.jic.market.request.PromotionRequest;
import com.jic.market.service.JicMarketPromotionExchangeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author mzp
 * @version 1.0
 * @description 换购促销活动
 * @date 2020/3/13 12:56
 */
@RestController
@RequestMapping("/promotionExchange")
@Api(tags = {"换购促销活动"})
@Slf4j
public class PromotionExchangeController implements PromotionExchangeApi {

    @Autowired
    JicMarketPromotionExchangeService jicMarketPromotionExchangeService;
    @Override
    @ApiOperation(value = "添加换购促销活动")
    @RequestMapping("/addPromotionExchange")
    @ResponseBody
    public RestResult<Long> save(@RequestBody  PromotionRequest p) {
        log.info("创建换购促销活动============》"+p);
        return RestResult.success(jicMarketPromotionExchangeService.
                savejicMarketPromotionExchangeService(p).getId());
    }
}
